<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * sys_user表创建
 */
class Migration_sys_user_permission extends CI_Migration
{
	public function up()
	{
		$this->dbforge->add_field([
			'user_or_role_id' => ['type' => 'CHAR', 'constraint' => 36,
				'comment' => '用户或角色id'],
			'permission_id' => ['type' => 'CHAR', 'constraint' => 36,
				'comment' => '权限id'],
		]);
		$this->dbforge->add_key(['user_or_role_id', 'permission_id'], TRUE);
		$this->dbforge->create_table('sys_user_permission', false, ['comment' => "'系统用户权限表'"]);
	}

	public function down()
	{
		$this->dbforge->drop_table('sys_user_permission');
	}
}
